package controller.backstage;

import dao.backstage.GoodsDao;
import dao.backstage.impl.GoodsDaoImpl;
import pojo.Goods;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;

@WebServlet(name = "deleteGoodsServlet",value = "/deleteGoods")
public class deleteGoodsServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        System.out.println("delete id is :"+id);
        GoodsDao goodsDao = new GoodsDaoImpl();

        goodsDao.removeGoods(id);
//        req.getRequestDispatcher("/goodsAll.jsp").forward(req,resp);
        resp.sendRedirect("/goodsAll.jsp");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}